<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" id="viewport" content="width=device-width, initial-scale=1">
    <title>消息</title>
    <link rel="stylesheet" href="../../front/css/common.css">
    <script type="text/javascript" src="../../front/js/jquery.min.js"></script>
    <script type="text/javascript" src="../../front/js/common.js"></script>
</head>
<body>
<div class="ly_header">消息<div class="ly_left goback"><img src="../../front/image/goback.png" alt=""></div></div>
<div class="mart20 messageall">
</div>
<script>
    function message(data){
        var temp='';
        for(var i=0;i<data.length;i++){
            temp+='<div class="message_list">'
                    +'<a href="queryPersonMessageDetail.action?id='+data[i].id+'" style="display:block">'
                        +'<div class="left">'
                        if(data[i].readStatus=="UN_READ"){
                            temp+='<img style="" src="../../front/image/newmessage.png" alt="">'
                        }else{
                            temp+='<img style="" src="../../front/image/oldmessage.png" alt="">'
                        }
                        temp+='</div>'
                        +'<div class="message_title">'
                            +'<div class="dw">'
                                +'<div class="">'+data[i].title+'</div>'
                                +'<div class="dw_r color6">'+data[i].createTimeStr+'</div>'
                            +'</div>'
                            +'<div class="color6 message_main">'+data[i].content
                            +'</div>'
                        +'</div>'
                    +'</a>'
               +' </div>'
        }
        return temp;
    }
    var l=1;
    $(function(){
        $.ajax({
            url: "queryPersonMessageList.action",
            type: "post",
            data: {currentPage:1,pageSize:10}, //发送数据,
            dataType: "json",
            async: false,
             success: function(data){
                $(".messageall").append(message(data.resultList));
                l++;
             },
             error:function(){
                alert()
             }
         })
    })
    $(window).scroll(function () {
        var scrollTop = $(this).scrollTop();
        var scrollHeight = $(document).height();
        var windowHeight = $(this).height();
        if (scrollTop + windowHeight == scrollHeight) {
            $.ajax({
                url: "/front/message/queryPersonMessageList.action",
                type: "post",
                data: {currentPage:1,pageSize:10}, //发送数据,
                dataType: "json",
                async: false,
                 success: function(data){
                    $(".messageall").append(message(data.resultList));
                    l++;
                 },
                 error:function(){
                    alert()
                 }
            });
        }
    })
</script>
</body>
</html>